home *** CD-ROM | disk | FTP | other *** search
- /* ToggleView.pvrx---Toggles:
- FullView -> Selected Obj (or) FullView -> Last View
- Selected Obj -> FullView
- Last View -> FullView
-
- Suggested "ProVector.pvrx" entries:
-
- 'RxDefine ToggleView' /* Attach to Rx tool */
- 'Define "ToggleView Ctrl-T" ToggleView' /* User menu item */
- 'DefineKey T "ToggleView"' /* Control Key */
-
- Copyright © 1992 by Stylus, Inc.
- Author: Jeff Blume
- */
-
- options results
-
- /* Try to lock project window.
- If can't get lock, do not proceed. */
- 'Lock'
- if rc ~= 0 then exit
-
- ZmCat = ""
- /* Get previous view, if exists */
- /* "ZmCat" is a conCATenated string of coords */
- ZmCat = getclip("ZoomView")
-
- /* Get the bounding box coords of any selected objs */
- 'SelExtent' Ext
- if rc = 0 then Sel = 1
-
- select
- when Sel = 1 then call ZoomSel /* Selected Obj exists, zoom it */
- when ZmCat ~= "" then call ZoomOld /* Previous view exists, use it */
- otherwise call ZoomFull
- end
-
- /* zoom into selected view */
- 'SetView Ext'
-
- 'Repair'
- 'UnLock'
-
- EXIT
-
- ZOOMOLD:
- do
- Ext.X1 = word(ZmCat,1)
- Ext.Y1 = word(ZmCat,2)
- Ext.X2 = word(ZmCat,3)
- Ext.Y2 = word(ZmCat,4)
- end
- call ClipView
- return
-
- ZOOMSEL:
- if getclip(ZmSel) = 1 & ZmCat = ""
- then do
- call setclip ZmSel,0
- call ZoomFull
- return
- end
- else call setclip ZmSel,1
- /* Border around objs 1/25th of view width */
- Xborder = abs(Ext.X2-Ext.X1) / 25
- /* Does this still assume 0,0 is up-left? */
- Ext.X1 = Ext.X1 - Xborder; Ext.Y1 = Ext.Y1 - Xborder
- Ext.X2 = Ext.X2 + Xborder; Ext.Y2 = Ext.Y2 + Xborder
- call setclip "ZoomView",""
- return
-
- ZOOMFULL:
- call ClipView
- 'GetPageSize' Ext
- return
-
- CLIPVIEW:
- 'GetView' CurExt
- ZmCat = CurExt.X1||" "||CurExt.Y1||" "||CurExt.X2||" "||CurExt.Y2
- call setclip "ZoomView",ZmCat
- return
-